//
//  main.m
//  TestC1
//
//  Created by boai on 2017/11/15.
//  Copyright © 2017年 BAHome. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        NSLog(@"Hello, World!");
        
        
        #pragma mark - 简单算法
        #pragma mark 0-100 的整数之和，方法1
        {
            int sum = 0;
            int num = 100;
            
            for (int i = 0; i <= num; i++)
            {
                sum = sum + i;
            }
            
            printf("0-100 的整数之和(1) = %d\n", sum);
        }
        #pragma mark 0-100 的整数之和，方法2
        {
            int num = 100;
            int sum = 0;
            sum = (1 + num) * num / 2;
            
            printf("0-100 的整数之和(2) = %d\n", sum);
        }
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    }
    return 0;
}
